/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kwikMart.accesData;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author WIL
 */
@Entity
@Table(name = "estado_compra")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EstadoCompra.findAll", query = "SELECT e FROM EstadoCompra e"),
    @NamedQuery(name = "EstadoCompra.findByIdEstadoCompra", query = "SELECT e FROM EstadoCompra e WHERE e.idEstadoCompra = :idEstadoCompra"),
    @NamedQuery(name = "EstadoCompra.findByNombreEstadoCompra", query = "SELECT e FROM EstadoCompra e WHERE e.nombreEstadoCompra = :nombreEstadoCompra"),
    @NamedQuery(name = "EstadoCompra.findByActivo", query = "SELECT e FROM EstadoCompra e WHERE e.activo = :activo")})
public class EstadoCompra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_estado_compra")
    private Integer idEstadoCompra;
    @Size(max = 50)
    @Column(name = "nombre_estado_compra")
    private String nombreEstadoCompra;
    @Column(name = "activo")
    private Boolean activo;
    @OneToMany(mappedBy = "idEstadoCompra")
    private List<Compra> compraList;

    public EstadoCompra() {
    }

    public EstadoCompra(Integer idEstadoCompra) {
        this.idEstadoCompra = idEstadoCompra;
    }

    public Integer getIdEstadoCompra() {
        return idEstadoCompra;
    }

    public void setIdEstadoCompra(Integer idEstadoCompra) {
        this.idEstadoCompra = idEstadoCompra;
    }

    public String getNombreEstadoCompra() {
        return nombreEstadoCompra;
    }

    public void setNombreEstadoCompra(String nombreEstadoCompra) {
        this.nombreEstadoCompra = nombreEstadoCompra;
    }

    public Boolean getActivo() {
        return activo;
    }

    public void setActivo(Boolean activo) {
        this.activo = activo;
    }

    @XmlTransient
    public List<Compra> getCompraList() {
        return compraList;
    }

    public void setCompraList(List<Compra> compraList) {
        this.compraList = compraList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEstadoCompra != null ? idEstadoCompra.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EstadoCompra)) {
            return false;
        }
        EstadoCompra other = (EstadoCompra) object;
        if ((this.idEstadoCompra == null && other.idEstadoCompra != null) || (this.idEstadoCompra != null && !this.idEstadoCompra.equals(other.idEstadoCompra))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.kwikMart.accesData.EstadoCompra[ idEstadoCompra=" + idEstadoCompra + " ]";
    }
    
}
